﻿namespace FESSC_MESSAGE
{
    public class MsgUserLogin : Msg
    {
        public MsgUserLogin(string uid, string pwdMD5, bool isRequest = true) : base(isRequest)
        {
            setReq(uid, pwdMD5);
        }

        public MsgUserLogin(string xml) : base(xml) { }

        private void setReq(string uid, string pwdMD5)
        {
            setHeader("USERLOGIN", 0, 0);
            var uinfo = add(root, "userinfo");
            add(uinfo, "id", uid);
            add(uinfo, "pwd", pwdMD5);
        }

        public string getUid()
        {
            return getValueByXpath("/rq/userinfo/id");
        }

        public string getPwdMD5()
        {
            return getValueByXpath("/rq/userinfo/pwd");
        }
    }

    public class MsgUserLogout : Msg
    {
        public MsgUserLogout(string xml) : base(xml) { }
        public MsgUserLogout(string uid,bool isRequest=true):base(isRequest)
        {
            setHeader("USERLOGOUT", 0, 0);
            var uinfo = add(root, "userinfo");
            add(uinfo, "id", uid);
        }

        public string getUid()
        {
            return getValueByXpath("/rq/userinfo/id");
        }

    }

}
